/*
 * Utiles_PanelBotonesMantenimiento.java
 *
 * Created on 21 de noviembre de 2008, 12:18 PM
 */

package helper;
import java.util.ArrayList;
import javax.swing.JButton;

/**
 *
 * @author  Vanessa
 */
public class JP_Utiles_PanelBotonesMantenimiento extends javax.swing.JPanel {
    
    /** Creates new form Utiles_PanelBotonesMantenimiento */
    public JP_Utiles_PanelBotonesMantenimiento( ArrayList alBotones ) {
        inicializaComponentes( alBotones );
    }
    
    public JP_Utiles_PanelBotonesMantenimiento( JP_Utiles_PanelModelo parent, ArrayList alBotones ) {
        this.parent = parent;
        inicializaComponentes( alBotones );        
    }

    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    
   
    //El m�todo initComponents es reemplazado por el m�todo inicializaComponentes    
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        btnNuevo = new javax.swing.JButton();
        btnGuardar = new javax.swing.JButton();
        btnModificar = new javax.swing.JButton();
        btnEliminar = new javax.swing.JButton();
        btnDeshacer = new javax.swing.JButton();
        btnLimpiar = new javax.swing.JButton();
        btnDetalles = new javax.swing.JButton();
        btnImprimir = new javax.swing.JButton();
        btnCerrar = new javax.swing.JButton();

        setBorder(javax.swing.BorderFactory.createTitledBorder(null, "Operaciones", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Arial", 1, 12))); // NOI18N
        setLayout(new java.awt.FlowLayout(java.awt.FlowLayout.RIGHT));

        btnNuevo.setFont(new java.awt.Font("Arial", 1, 12)); // NOI18N
        btnNuevo.setIcon(new javax.swing.ImageIcon(getClass().getResource("/org/fife/plaf/Office2003/new.gif"))); // NOI18N
        btnNuevo.setText("Nuevo");
        add(btnNuevo);

        btnGuardar.setFont(new java.awt.Font("Arial", 1, 12));
        btnGuardar.setIcon(new javax.swing.ImageIcon(getClass().getResource("/org/fife/plaf/Office2003/save.gif"))); // NOI18N
        btnGuardar.setText("Guardar");
        add(btnGuardar);

        btnModificar.setFont(new java.awt.Font("Arial", 1, 12));
        btnModificar.setIcon(new javax.swing.ImageIcon(getClass().getResource("/org/fife/plaf/Office2003/replace.gif"))); // NOI18N
        btnModificar.setText("Modificar");
        add(btnModificar);

        btnEliminar.setFont(new java.awt.Font("Arial", 1, 12));
        btnEliminar.setIcon(new javax.swing.ImageIcon(getClass().getResource("/org/fife/plaf/Office2003/delete.gif"))); // NOI18N
        btnEliminar.setText("Eliminar");
        add(btnEliminar);

        btnDeshacer.setFont(new java.awt.Font("Arial", 1, 12));
        btnDeshacer.setIcon(new javax.swing.ImageIcon(getClass().getResource("/org/fife/plaf/Office2003/undo.gif"))); // NOI18N
        btnDeshacer.setText("Deshacer");
        add(btnDeshacer);

        btnLimpiar.setFont(new java.awt.Font("Arial", 1, 12)); // NOI18N
        org.jdesktop.application.ResourceMap resourceMap = org.jdesktop.application.Application.getInstance(controlaccionescomercial.ControlAccionesComercialApp.class).getContext().getResourceMap(JP_Utiles_PanelBotonesMantenimiento.class);
        btnLimpiar.setIcon(resourceMap.getIcon("btnLimpiar.icon")); // NOI18N
        btnLimpiar.setText("Limpiar");
        add(btnLimpiar);

        btnDetalles.setFont(new java.awt.Font("Arial", 1, 12));
        btnDetalles.setIcon(new javax.swing.ImageIcon(getClass().getResource("/org/fife/plaf/Office2003/printpreview.gif"))); // NOI18N
        btnDetalles.setText("Detalles");
        add(btnDetalles);

        btnImprimir.setFont(new java.awt.Font("Arial", 1, 12));
        btnImprimir.setIcon(new javax.swing.ImageIcon(getClass().getResource("/org/fife/plaf/Office2003/print.gif"))); // NOI18N
        btnImprimir.setText("Imprimir");
        add(btnImprimir);

        btnCerrar.setFont(new java.awt.Font("Arial", 1, 12));
        btnCerrar.setIcon(new javax.swing.ImageIcon(getClass().getResource("/org/fife/plaf/Office2003/close.gif"))); // NOI18N
        btnCerrar.setText("Cerrar");
        add(btnCerrar);
    }// </editor-fold>//GEN-END:initComponents

    public void inicializaComponentes( ArrayList alBotones ){
        setLayout(new java.awt.FlowLayout(java.awt.FlowLayout.RIGHT));
        javax.swing.ActionMap actionMap = org.jdesktop.application.Application.getInstance( controlaccionescomercial.ControlAccionesComercialApp.class).getContext().getActionMap(JP_Utiles_PanelModelo.class, parent);
                
        if( alBotones.contains( new Integer( BOTON_NUEVO ) ) ){
            btnNuevo = new javax.swing.JButton();
            this.btnNuevo.setAction(actionMap.get("nuevo"));
            btnNuevo.setFont(new java.awt.Font("Arial", 1, 12)); // NOI18N
            btnNuevo.setIcon(new javax.swing.ImageIcon(getClass().getResource("/org/fife/plaf/Office2003/new.gif"))); // NOI18N
            btnNuevo.setText("Nuevo");            
            add(btnNuevo);
        }
        
        if( alBotones.contains( new Integer( BOTON_GUARDAR ) ) ){
            btnGuardar = new javax.swing.JButton();
            this.btnGuardar.setAction(actionMap.get("guardar"));
            btnGuardar.setFont(new java.awt.Font("Arial", 1, 12)); // NOI18N
            btnGuardar.setIcon(new javax.swing.ImageIcon(getClass().getResource("/org/fife/plaf/Office2003/save.gif"))); // NOI18N
            btnGuardar.setText("Guardar");           
            add(btnGuardar);
        }

        if( alBotones.contains( new Integer( BOTON_MODIFICAR ) ) ){
            btnModificar = new javax.swing.JButton();
            this.btnModificar.setAction(actionMap.get("modificar"));
            btnModificar.setFont(new java.awt.Font("Arial", 1, 12)); // NOI18N
            btnModificar.setIcon(new javax.swing.ImageIcon(getClass().getResource("/org/fife/plaf/Office2003/replace.gif"))); // NOI18N
            btnModificar.setText("Modificar");            
            add(btnModificar);
        }
        
        if( alBotones.contains( new Integer( BOTON_ELIMINAR ) ) ){        
            btnEliminar = new javax.swing.JButton();
            this.btnEliminar.setAction(actionMap.get("eliminar"));
            btnEliminar.setFont(new java.awt.Font("Arial", 1, 12)); // NOI18N
            btnEliminar.setIcon(new javax.swing.ImageIcon(getClass().getResource("/org/fife/plaf/Office2003/delete.gif"))); // NOI18N
            btnEliminar.setText("Eliminar");            
            add(btnEliminar);
        }
        
        if( alBotones.contains( new Integer( BOTON_DESHACER ) ) ){
            btnDeshacer = new javax.swing.JButton();
            this.btnDeshacer.setAction(actionMap.get("deshacer"));
            btnDeshacer.setFont(new java.awt.Font("Arial", 1, 12)); // NOI18N
            btnDeshacer.setIcon(new javax.swing.ImageIcon(getClass().getResource("/org/fife/plaf/Office2003/undo.gif"))); // NOI18N
            btnDeshacer.setText("Deshacer");
            add(btnDeshacer);
        }
        
        if( alBotones.contains( new Integer( BOTON_LIMPIAR ) ) ){
            btnLimpiar = new javax.swing.JButton();
            this.btnLimpiar.setAction(actionMap.get("limpiar"));
            btnLimpiar.setFont(new java.awt.Font("Arial", 1, 12)); // NOI18N
            btnLimpiar.setIcon(new javax.swing.ImageIcon(getClass().getResource("/gui/resources/images/img_limpiar.png"))); // NOI18N
            btnLimpiar.setText("Limpiar");            
            add(btnLimpiar);
        }
              
        if( alBotones.contains( new Integer( BOTON_DETALLES ) ) ){  
            btnDetalles = new javax.swing.JButton();
            this.btnDetalles.setAction(actionMap.get("detalles"));
            btnDetalles.setFont(new java.awt.Font("Arial", 1, 12)); // NOI18N
            btnDetalles.setIcon(new javax.swing.ImageIcon(getClass().getResource("/org/fife/plaf/Office2003/printpreview.gif"))); // NOI18N
            btnDetalles.setText("Detalles");            
            add(btnDetalles);
        }
        
        if( alBotones.contains( new Integer( BOTON_IMPRIMIR ) ) ){
            btnImprimir = new javax.swing.JButton();
            this.btnImprimir.setAction(actionMap.get("imprimir"));
            btnImprimir.setFont(new java.awt.Font("Arial", 1, 12)); // NOI18N
            btnImprimir.setIcon(new javax.swing.ImageIcon(getClass().getResource("/org/fife/plaf/Office2003/print.gif"))); // NOI18N
            btnImprimir.setText("Imprimir");            
            add(btnImprimir);
        }

        if( alBotones.contains( new Integer( BOTON_CERRAR ) ) ){
            btnCerrar = new javax.swing.JButton();
            this.btnCerrar.setAction(actionMap.get("cerrar"));
            btnCerrar.setFont(new java.awt.Font("Arial", 1, 12)); // NOI18N
            btnCerrar.setIcon(new javax.swing.ImageIcon(getClass().getResource("/org/fife/plaf/Office2003/close.gif"))); // NOI18N
            btnCerrar.setText("Cerrar");            
            add(btnCerrar);
        }
    }
    
    public static void main( String[] args ){
        ArrayList al = new ArrayList( 1 );
        al.add( new Integer( JP_Utiles_PanelBotonesMantenimiento.BOTON_NUEVO ) );
        al.add( new Integer( JP_Utiles_PanelBotonesMantenimiento.BOTON_CERRAR ) );
        al.add( new Integer( JP_Utiles_PanelBotonesMantenimiento.BOTON_IMPRIMIR ) );
        al.add( new Integer( JP_Utiles_PanelBotonesMantenimiento.BOTON_GUARDAR ) );
        al.add( new Integer( JP_Utiles_PanelBotonesMantenimiento.BOTON_LIMPIAR ) );
        
        Utiles_Panel.creaVentana(new JP_Utiles_PanelBotonesMantenimiento( al ), "Prueba" );
    }

    public JButton getBtnCerrar() {
        return btnCerrar;
    }

    public JButton getBtnDeshacer() {
        return btnDeshacer;
    }

    public JButton getBtnDetalles() {
        return btnDetalles;
    }

    public JButton getBtnEliminar() {
        return btnEliminar;
    }

    public JButton getBtnGuardar() {
        return btnGuardar;
    }

    public JButton getBtnImprimir() {
        return btnImprimir;
    }

    public JButton getBtnLimpiar() {
        return btnLimpiar;
    }

    public JButton getBtnModificar() {
        return btnModificar;
    }

    public JButton getBtnNuevo() {
        return btnNuevo;
    }

     
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton btnCerrar;
    private javax.swing.JButton btnDeshacer;
    private javax.swing.JButton btnDetalles;
    private javax.swing.JButton btnEliminar;
    private javax.swing.JButton btnGuardar;
    private javax.swing.JButton btnImprimir;
    private javax.swing.JButton btnLimpiar;
    private javax.swing.JButton btnModificar;
    private javax.swing.JButton btnNuevo;
    // End of variables declaration//GEN-END:variables
    private JP_Utiles_PanelModelo parent;
        
    //Establezco variables est�ticas que me van habilitar la creaci�n de botones
    public static int BOTON_NUEVO = 1;
    public static int BOTON_GUARDAR = 2;
    public static int BOTON_MODIFICAR = 3;
    public static int BOTON_ELIMINAR = 4;
    public static int BOTON_DESHACER = 5;
    public static int BOTON_LIMPIAR = 6;
    public static int BOTON_DETALLES = 7;
    public static int BOTON_IMPRIMIR = 8;
    public static int BOTON_CERRAR = 9;
}
